<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

//注册页面
Route::get('/register','\App\Http\Controllers\RegisterController@index');
Route::post('/register','\App\Http\Controllers\RegisterController@register');
//登录
Route::get('/login','\App\Http\Controllers\LoginController@index');
Route::post('/login','\App\Http\Controllers\LoginController@login');
//退出
Route::get('/loginout','\App\Http\Controllers\LoginController@loginout');
//个人设置
Route::get('/user/setting','\App\Http\Controllers\UserController@setting');
//个人设置操作
Route::post('/user/setting','\App\Http\Controllers\UserController@settingStore');
//文章列表页
Route::get('/posts','\App\Http\Controllers\PostController@index');
//文章详情页
Route::get('/posts/{post}','\App\Http\Controllers\PostController@show');
//创建文章
Route::get('/create','\App\Http\Controllers\PostController@create');
Route::post('/store','\App\Http\Controllers\PostController@store');
//编辑文章
Route::get('/posts/{post}/edit','\App\Http\Controllers\PostController@edit');
Route::put('/update','\App\Http\Controllers\PostController@update');
//删除文章
Route::get('/posts/{$post}/delete','\App\Http\Controllers\PostController@delete');
//图片上传
Route::post('posts/image/upload','\App\Http\Controllers\PostController@imageUpload');

//提交评论
Route::post('/comment','\App\Http\Controllers\PostController@comment');

//赞
Route::get('/posts/{post}/zan','\App\Http\Controllers\PostController@zan');
//取消赞
Route::get('/posts/{post}/unzan','\App\Http\Controllers\PostController@unzan');
//个人中心
Route::get('/user/{user}','\App\Http\Controllers\UserController@show');
Route::post('/user/{user}/fan','\App\Http\Controllers\UserController@fan');
Route::post('/user/{user}/unfan','\App\Http\Controllers\UserController@unfan');


//引入管理后台
include_once('admin.php');


